import request from '@/utils/request'

// 查询建筑信息列表
export function listBuilding(query) {
  return request({
    url: '/construction/building/list',
    method: 'post',
    data: query
  })
}

export function levelBuildingList(query) {
  return request({
    url: '/construction/building/mainBuildingList',
    method: 'post',
    data: query
  })
}

// 查询建筑信息详细
export function getBuilding(id) {
  return request({
    url: '/construction/building/' + id,
    method: 'get'
  })
}
// 查询所属建筑信息
export function getBuildingBelong(id) {
  return request({
    url: '/construction/building/forComp/' + id,
    method: 'get'
  })
}

// 新增建筑信息
export function addBuilding(data) {
  return request({
    url: '/construction/building',
    method: 'post',
    data: data
  })
}

// 修改建筑信息
export function updateBuilding(data) {
  return request({
    url: '/construction/building',
    method: 'put',
    data: data
  })
}

// 删除建筑信息
export function delBuilding(id) {
  return request({
    url: '/construction/building/' + id,
    method: 'delete'
  })
}

// 删除建筑信息
export function treeBuilds() {
  return request({
    url: '/construction/building/treeBuilds',
    method: 'get'
  })
}


// 查询建筑信息列表 (根据父级id 查所有类型的下级建筑及父级本身)  --（显示最大级别）通过建筑类型传参级别
export function listBuildChildrenShowMaxWithParent(query) {
  return request({
    url: '/construction/building/listChildShowMaxWithParent',
    method: 'post',
    data: query
  })
}





// 查询建筑信息列表(只显示建筑及单元)
export function listBuildingOnlyOneLevel(query) {
  return request({
    url:  '/construction/building/listOnlyOneLevel',
    method: 'post',
    data: query
  })
}
